#列表初始化
name_list = ["坐坐","左左","哟哟","悠悠"]

#增 append
name_list.append("柯南")
name_list.append("哦吼") #加在队列后
print(name_list)

#移除元素 remove/.pop
#name_list.remove("坐坐")
 #name_list.remove(1) #移除不存在元素会报异常
print(name_list.pop(5)) #移除指定元素，并返回内容
print(name_list)

#改 
name_list[0] = "jsj"
print(name_list)

#查阅
print(name_list[2])
print(name_list.index("柯南")) #不适用嵌套
for i in name_list:
    print(i,end=" ") #遍历
"""倒序遍历for i in name_list(4,0,-1)"""
print("*"*100)

#排序 .sort
s = [5,9,8,6,5,3,1]
s.sort() #排序
print(s)
s.sort(reverse=True)
print(s)
print("*"*100)

#列表嵌套
stu = [
    ["做","左","作","👈"],
    [1,2,3]
]
print(stu)
print(stu[0][1])
print(stu[1][1])
print(stu[1][2]) #超出范围会报异常
